package com.fund.common.pojo;

import lombok.*;

@Getter
@Setter
@NoArgsConstructor
public class Result<T> {
    private String code;
    private String msg;
    private T data;

    public Result(String code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> Result<T> success(T data) {
        return new Result<T>("200",null,data);
    }
    public static <T> Result<T> success() {
        return success(null);
    }
    public static <T> Result<T> fail(String msg) {
        return new Result<T>("500",msg,null);
    }
    public static <T> Result<T> fail() {
        return fail(null);
    }
    public static <T> Result<T> fail(String msg, String code) {
        return new Result<T>(code,msg,null);
    }
}
